from src.main.server.mapper.impl.login_impl import LoginImpl
from src.main.server.pojo.Volunteer import Volunteer

class LoginController:
    def __init__(self):
        self.vol = None

    def login(self, username, password):
        """login登录操作"""
        self.vol = Volunteer(username, password)
        result= LoginImpl().login(self.vol)
        if len(result) > 0:
            return True
        else:
            return False
    def register(self, username, password, age, gender, pho_num, email):
        """注册操作"""
        if str(gender) == '男':
            gender = 0
        else:
            gender = 1
        self.vol = Volunteer(username, password, age, gender, pho_num, email)
        LoginImpl().register(self.vol)